package com.itheima.advice;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author itheima
 * @since 2021-10-25
 */
@Component
@Aspect
@Transactional
public class AopAdvice {

    // 接入点
    @Pointcut("execution(public java.util.List<com.itheima.domain.Order> com.itheima.service.OrderService.getList(*) throws Exception)")
    private void pt() {

    }

    // 通知
    @Around("pt()")
    public Object around(ProceedingJoinPoint pjp) throws Throwable {
        System.out.println("123123");
        pjp.proceed();
        Object[] args = pjp.getArgs();
        // null, 1 , 2

        System.out.println(pjp.getSignature().getName());
        // getList
        return new Object();
    }

}
